cls
set /a count = 1
set HAP=entry\build\default\outputs\default\entry-default-signed.hap
set SYS_HAP=/system/app/com.example.distributedcalc/Calc_Demo.hap
@echo off
:Waiting
cls
echo %count% Waiting
if exist "%HAP%" (
	goto Start
)
timeout 1 > NUL
cls
echo %count% Waiting .
if exist "%HAP%" (
	goto Start
)
timeout 1 > NUL
cls
echo %count% Waiting ..
if exist "%HAP%" (
	goto Start
)
timeout 1 > NUL
cls
echo %count% Waiting ...
if exist "%HAP%" (
	goto Start
)
timeout 1 > NUL
goto Waiting

:Start
echo Start loading

hdc_std target mount
timeout 1 > NUL
hdc_std shell rm -rf ./data/service/* 
hdc_std shell mount -o remount,rw /
hdc_std shell rm -rf /system/app/com.ohos.callui\*
hdc_std file send "%HAP%" "%SYS_HAP%"
del "%HAP%"
hdc_std shell chown root:root "%SYS_HAP%"
timeout 1 > NUL
hdc_std shell setenforce 0
hdc_std shell sync
hdc_std shell sync /system/bin/udevadm trigger
timeout 1 > NUL
hdc_std shell reboot
set /a count += 1
echo end loading
timeout 6 > NUL
goto Waiting


hdc_std shell ls /system/app/com.ohos.callui